package cn.sinata.wanglin.village.fragment;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
import com.xilada.xldutils.fragment.BaseLazyFragment;
import com.xilada.xldutils.utils.SharedPreferencesUtils;

import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import cn.sinata.wanglin.R;
import cn.sinata.wanglin.adapter.NewsinfoPagerAdapter;
import cn.sinata.wanglin.commonutils.Constant;
import cn.sinata.wanglin.model.Active;
import cn.sinata.wanglin.net.HttpManager;
import cn.sinata.wanglin.net.model.util.ResultDataSubscriber;

/**
 * description：小区---新闻资讯
 * Created by kaihongwu on 2016/12/06 上午 9:45
 */
public class NewsinformationFragment extends BaseLazyFragment {
    @BindView(R.id.viewpager_newsinfo)
    ViewPager viewpager;//
    @BindView(R.id.tabs_newsinfo)
    TabLayout tabs;//

    @Override
    protected int getContentViewLayoutID() {
        return R.layout.fragment_newsinformation;
    }

    @Override
    protected void onFirstVisibleToUser() {
        setupViewPager();
    }

    @Override
    protected void onVisibleToUser() {

    }

    @Override
    protected void onInvisibleToUser() {

    }
    private void setupViewPager() {
            List<String> titles = new ArrayList<>();
            titles.add("全部");
            titles.add("热议");
            NewsinfoPagerAdapter mNewsinfoPagerAdapter=new NewsinfoPagerAdapter(getChildFragmentManager(),titles);
            viewpager.setOffscreenPageLimit(2);
            viewpager.setAdapter(mNewsinfoPagerAdapter);
            tabs.setupWithViewPager(viewpager);
    }

}
